<template>
	<div>
		<el-form v-model="entityQueryForm" inline size="mini" style="text-align: left">
			<el-form-item>
				<el-button @click="getEntityListByPage" type="primary" >查询</el-button>
			</el-form-item>
			<el-form-item style="float: right">
				<el-button v-if="hasAuth('dept:add')" @click="showAddEntityDialogHandler" type="primary" >新增</el-button>
			</el-form-item>
		</el-form>
		<el-dialog :visible.sync="showEntityDialog" v-if="showEntityDialog" fullscreen :modal="false">
			<el-form :model="entity" label-width="130px" size="mini">
				<el-form-item label="部门编号">
					<el-input v-model="entity.deptno"></el-input>
				</el-form-item>
				<el-form-item label="部门名称">
					<el-input v-model="entity.dname"></el-input>
				</el-form-item>
				<el-form-item label="部门所在地">
					<el-input v-model="entity.loc"></el-input>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="showEntityDialog = false" size="mini">取消</el-button>
				<el-button @click="entityDialogConfirm" size="mini">确定</el-button>
			</div>
		</el-dialog>
		<el-table :data="entityList">
			<el-table-column prop="deptno" label="部门编号"></el-table-column>
			<el-table-column prop="dname" label="部门名称"></el-table-column>
			<el-table-column prop="loc" label="部门所在地"></el-table-column>
			<el-table-column label="操作" width="150" v-if="hasAuth('dept:update')||hasAuth('dept:delete')">
				<template slot-scope="scope">
					<el-button class="el-icon-edit-outline" @click="showUpdateEntityDialogHandler(scope.$index, scope.row)" v-if="hasAuth('dept:update')" type="primary" size="mini"></el-button>
					<el-button class="el-icon-delete-solid" @click="deleteEntity(scope.$index, scope.row)" v-if="hasAuth('dept:delete')" type="danger" size="mini"></el-button>
				</template>
			</el-table-column>
		</el-table>
		<el-pagination
			@size-change="sizeChangeHandle" @current-change="currentChangeHandle"
			layout="total, sizes, prev, pager, next, jumper" :current-page="currentPage"
			:page-sizes="[10,15,30,50]" :page-size="pageSize" :total="total">
		</el-pagination>
	</div>
</template>
<script>
	import Mixin4Curd from "../../Mixin4Curd";
	export default {
		name: "Dept",
		mixins: [Mixin4Curd],
		data: function () {
			return {
				entityName4LowerCamel:'dept',
				entityName4UpperCamel:'Dept',
				primaryKey:'deptno',
			}
		},
		methods: {
		},
	}
</script>
<style>

</style>
